<?php 
require_once('kelas/fungsi.php');
require_once('kelas/amankanParam.php');
require_once('kelas/record.php');

require_once('kelas/kategori.php');
require_once('kelas/produk.php');
$dtGet=$objParamAman->getMethod();
$dtPost=$objParamAman->postMethod();
$dtDetail = $objProduk->getDetail($dtGet['id']);
echo $objFungsi->buatJudul('Detail Produk');
if(is_array($dtDetail)){
 ?>
<link rel="stylesheet" type="text/css" href="<?php echo BASEURL."css/isi.css"; ?>">
<div>
<table border="0">
    <tr>
        <td colspan="3" rowspan="5">
            <img style="width: 300px;height:400px" src="<?php echo BASEURL.'/produk/'.$dtDetail['gambar'];?>" />            
        </td>
        <td>Nama Produk</td>
        <td><?php echo $dtDetail['nama']; ?></td>
    </tr>
    <tr>
        <td>Kategori</td>
        <td><?php echo $dtDetail['nama_kategori']; ?></td>
    </tr>
    <tr>
        <td>Dimensi</td>
        <td><?php echo $dtDetail['panjang']."x".$dtDetail['lebar'].'x'.$dtDetail['tinggi']; ?>cm.</td>
    </tr>
    <tr>
        <td>Stok</td>
        <td><?php echo $dtDetail['jumlah']; ?></td>
    </tr>

    <tr>
        <td colspan="5"><?php echo $dtDetail['keterangan']; ?></td>
    </tr>
    <tr>
        <td colspan="3">Harga <?php echo ($dtDetail['diskon']>0)?"(diskon ".$dtDetail['diskon']." %)":''; ?></td>
        <td colspan="2"><?php 
        $hrg = ($dtDetail['diskon']>0)?$dtDetail['harga_jual']-($dtDetail['harga_jual']*($dtDetail['diskon']/100)):$dtDetail['harga_jual'];
        echo($dtDetail['diskon']>0)?"<font style='color:red;font-size:small;text-decoration:line-through'>".(number_format( $dtDetail['harga_jual'],0,'.',','))."</font><br>":""; 
        echo $objFungsi->formatUang($hrg); ?></td>
    </tr>
    <tr>
        <td colspan="5" style="text-align:center">
            <a href="<?php echo BASEURL."proses/belanja.php?on=addCart&id=".$dtDetail['id'] ?>" class="button">Add To Cart</a>
        </td>
    </tr>
</table>
</div>
<div>

</div>
<?php
}
else{
   echo $objFungsi->alert('Produk Ini Tidak Ada').$objFungsi->redirect(BASEURL.'?v=store');
}
//$objFungsi->var_dump($dtDetail);
?>